
module.exports = {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  router:{
    middleware:'auth',

    //扩展路由
    extendRoutes(routes,resolve){
      console.log(routes);
      routes.push({
        name:'home',
        path:'/index',
        component: resolve(__dirname,'pages/index.vue')
      })
    }
  },
  /*
  ** 定义系统默认loading效果，或者指定一loading组件
  */
  // loading: { color: '#399', height:'3px' },
  loading: '~/components/loading.vue',
  /*
  ** 全局样式
  */
  css: [
    'assets/css/transition.css'
  ],
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '~/plugins/router',
    {
      src:'~/plugins/axios',
      ssr:true//服务端
    }
  ],
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    '@nuxtjs/axios'
  ],

  axios:{
    proxy:true,//开启axios跨域
    // prefix:'/api',//baseUrl
  },
  proxy:{
    '/api/':{
      target:'http://localhost:3001',//代理转发的地址
      changeOrigin:true,
      pathRewrite:{
        // '^/api':''
      }
    }
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend (config, ctx) {
    }
  }
}
